package com.sali.asyncollection.service.impl;


import com.sali.asyncollection.model.BaseRspDTO;
import com.sali.asyncollection.model.LabelDTO;
import com.sali.asyncollection.model.LabelParam;
import com.sali.asyncollection.service.IBaseTask;
import com.sali.asyncollection.service.ILabelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @description:
 * @author: zhang hang
 * @date: 2023/3/15 21:02.
 * @version: 1.0
 */
@Service
public class LabelStrategyTask implements IBaseTask {

    @Autowired
    private ILabelService labelService;

    @Override
    public String getTaskType() {
        return "labelDTO";
    }

    @Override
    public BaseRspDTO<Object> execute(String req) {
        LabelParam labelParam = new LabelParam(req);
        LabelDTO labelDTO = labelService.queryLabelInfo(labelParam);
        BaseRspDTO<Object> bannerBaseRspDTO = new BaseRspDTO<Object>();
        bannerBaseRspDTO.setKey(getTaskType());
        bannerBaseRspDTO.setData(labelDTO);
        return bannerBaseRspDTO;
    }
}
